package com;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import org.apache.commons.dbcp2.BasicDataSource;

public class JDBC_05_Test_02 {

	public static void main(String[] args) throws Exception {
//		for (int i = 0; i < 10; i++) {
//			System.out.println(BasicDataSourceUtil.getInstance().getBasicDataSource());
//		}

		BasicDataSource bds = BasicDataSourceUtil.getInstance().getBasicDataSource();

		// 获取连接
		Connection connection = bds.getConnection();
		Statement statement = connection.createStatement();
		String sql = "select * from student";
		ResultSet resultSet = statement.executeQuery(sql);

		while (resultSet.next()) {
			System.out.println(resultSet.getString("sname"));
		}
	}

}
